package threaduse;

/**
 * @description:
 * @Author yyp
 * @time 2022/3/29
 */
public class ThreadState_ {
    public static void main(String[] args)throws InterruptedException {
        State state = new State();
        state.start();
        while(Thread.State.TERMINATED!=state.getState()){
            System.out.println(state.getName()+" "+state.getState());
            Thread.sleep(500);
        }
    }
}

class State extends Thread{
    @Override
    public void run(){
        while(true){
            for (int i = 0; i < 10; i++) {
                try{
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
            break;
        }
    }
}
